package org.handover.serviceImp;

import org.handover.domain.User;
import org.handover.repository.UserRepository;
import org.handover.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;

@Service
public class UserServiceImp implements UserService {
    @Autowired
    private HttpSession httpSession;
    @Autowired
    private UserRepository userRepository;

    @Override
    public void save(User user) {
        user.setUserGroup(((User)httpSession.getAttribute("user")).getUserGroup());
        userRepository.save(user);
    }
}
